<template>
  <div>
    <!-- cussState:
			0 ：未定义
			1 ：修改信息
			2 ：申请入库
			...

			可扩展
		 -->
    <base-car-edit 
      @submit="submit"
      :cussState="2"
      
      ></base-car-edit>
  </div>
</template>

<script>

  import baseCarEdit from 'comp/base/baseCarEdit'

  export default {
    components: {
      baseCarEdit
    },
    mounted () {
      this.$children[0].rules.regionId = [{
        required: true,
        message: "请选择车厂区域",
        trigger: "blur"
      }]
		},
    methods: {
      submit (forms) {
        forms.append('userId', this.$sess.get('userInfo').userId)
        this.$axios
          .post(this.$api.toStorage, forms, {
            "Content-Type": "multipart/form-data"
          })
          .then(res => {
            if (res.data.code != 1) {
              this.$message({
                type: "warning",
                message: res.data.msg
              });
            } else {
              this.$message({
                type: "success",
                message: "申请成功"
              });
              this.$router.back("/car");
            }
          });
      }
    }
    
  }
</script>

